package ua.org.nuos.sdms.clientgui.client.components.tabs;

import com.vaadin.ui.Component;
import ua.org.nuos.sdms.clientgui.client.listeners.TabSelectionChangeListener;

/**
 * Created by IntelliJ IDEA.
 * User: dio
 * Date: 18.03.12
 * Time: 18:45
 * To change this template use File | Settings | File Templates.
 */
public class DataTab extends CustomTab {

    private TabSelectionChangeListener listener;

    private Component dataContainer;

    public DataTab(String caption) {
        super(caption);
        isDataViewer = true;
    }

    public DataTab(String caption, Component dataContainer) {
        super(caption);
        this.dataContainer = dataContainer;
        isDataViewer = true;
    }

    public void setDataContainer(Component component) {
        this.dataContainer = component;
    }

    public Component getDataContainer() {
        return dataContainer;
    }

    public void setListener(TabSelectionChangeListener listener) {
        this.listener = listener;
    }

    @Override
    public void select() {
        listener.changeSelection(this);
        if (!isSelected) {
            tabButton.removeStyleName("custom_tab_active");
            tabButton.setStyleName("custom_tab_inactive");
            tabButton.addStyleName("text_float_left");
            isSelected = true;
        }
    }

}

